import Vue from 'vue'
import VueRouter, { RouteConfig } from 'vue-router'

Vue.use(VueRouter)

const routes: Array<RouteConfig> = [
  {
    path: '/options',
    name: 'Options',
    component: () => import('../pages/options.vue'),
    meta: {
      title: 'Options'
    }
  },
  {
    path: '/popup',
    name: 'Popup',
    component: () => import('../pages/popup.vue'),
    meta: {
      title: 'Popup'
    }
  }
]

const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

router.beforeEach((to, from, next) => {
  document.title = to.meta.title
  next()
})
export default router
